<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <ui:composition template="templateadmin.xhtml">
            <ui:define name="content">
                <center>
                    <h1>Management Package Type</h1>
                    <br/>

                    <h:form id="form1">
                        <table border="0" cellpadding="0" cellspacing="0" id="product-table">
                            <tr>
                                <th class="table-header-repeat line-left minwidth-1" width="150px"><a href="">Package Type ID</a>	</th>
                                <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Package Type Name</a></th>
                                <th class="table-header-repeat line-left minwidth-1" width="320px"><a href="">Description</a></th>
                                <th class="table-header-repeat line-left minwidth-1" width="100px"><a href="">Option</a></th>
                            </tr>

                            <ui:repeat value="#{mngPackageTypeBean.listPackageType}" var="listPT">
                                <tr>
                                    <td>#{listPT.packageTypeID}</td>
                                    <td><h:inputText id="txtName" value="#{listPT.packageTypeName}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                                        <br/>
                                        <h:message for="txtName" styleClass="error-inner"></h:message>
                                    </td>
                                    <td><h:inputTextarea id="txtDes" value="#{listPT.description}" styleClass="form-textarea2" required="true" requiredMessage="This field is required."></h:inputTextarea>
                                        <br/>
                                        <h:message for="txtDes" styleClass="error-inner"></h:message>
                                    </td>
                                    <td><h:commandButton action="#{mngPackageTypeBean.updateTypeAction(listPT)}" value="Update" styleClass="form-update" onclick="show_alert()"></h:commandButton></td>
                                </tr>
                            </ui:repeat>
                        </table>
                    </h:form>
                    <h:form id ="form2">
                        <table border="0" cellpadding="0" cellspacing="0" id="product-table" style="margin: 0 0 0 151px;">
                            <tr>
                                <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Package Type Name</a></th>
                                <th class="table-header-repeat line-left minwidth-1" width="320px"><a href="">Description</a></th>
                                <th class="table-header-repeat line-left minwidth-1" width="100px"><a href="">Option</a></th>
                            </tr>
                            <tr>
                                <td><h:inputText id="newName" value="#{mngPackageTypeBean.packType.packageTypeName}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                                    <br/>
                                    <h:message for="newName" styleClass="error-inner"></h:message>
                                </td>
                                <td><h:inputTextarea id="newDes" value="#{mngPackageTypeBean.packType.description}" styleClass="form-textarea2" required="true" requiredMessage="This field is required."></h:inputTextarea>
                                    <br/>
                                    <h:message for="newDes" styleClass="error-inner"></h:message>
                                </td>
                                <td><h:commandButton action="#{mngPackageTypeBean.addNewTypeAction}" styleClass="form-submit"></h:commandButton></td>
                            </tr>


                        </table>
                    </h:form>

                </center>
                <script type="text/javascript">
                    function show_alert()
                    {
                        alert("Package Type has been changed!");
                    }function show_alert2()
                    {
                        alert("Add new Package Type complete!");
                    }
                </script>                                 
            </ui:define>
        </ui:composition>
    </h:body>
</html>

